/*
 * Filename: g:\espidf_workspace\idf_S3_T-Watch\main\app\music.h
 * Path: g:\espidf_workspace\idf_S3_T-Watch\main\app
 * Created Date: Tuesday, July 1st 2025, 10:25:00 am
 * Author: sss
 * 
 * Copyright (c) 2025 Your Company
 */
#pragma once
#include "adf_service.h"
#include <vector>
#include <string>
#include "ui.h"

struct MusicInfo
{
    /* data */
    std::string name;
    std::string path;
    std::string artist;
    std::string album;
    int duration;
};


class Music {
public:
    static Music& get_instance(){
        static Music instance;
        return instance;
    };
    Music(const Music&) = delete;
    Music& operator=(const Music&) = delete;
    void play();
    void pause();
    void stop();
    void play_next();
    void play_prev();
    void add_song(MusicInfo song);
    void my_ui_event_handler(lv_event_t * e);

    void get_song_list(const char* http_url);

private:
    Music();
    ~Music();
    std::vector<MusicInfo> songs;
    bool playing = false;// is music playing?
    int song_index = 0;// current playing song index
    int track_duration = 0;// current playing song duration

    // lv_obj_t* ui_PlayBtn = NULL;
    // lv_obj_t* ui_PauseBtn = NULL;
    // lv_obj_t* ui_PrevBtn = NULL;
    // lv_obj_t* ui_NextBtn = NULL;
    // lv_obj_t* ui_SongName = NULL;
    // lv_obj_t* ui_SongArtist = NULL;
    // lv_obj_t* ui_SongAlbum = NULL;

};